import {
    all_router_key
} from '@/config/storage-keys'
import Storage from '@/utils/storage-manage'

/**
 * 路由权限模块
 */
let RouterList = []
const requireComponent = require.context('@/router/router-pages/', true, /\.vue$/)
requireComponent.keys().forEach(filePath => {
    const componentConfig = requireComponent(filePath).default
    const fileName = filePath.match(/.\/(\S*).vue/)[1]
    RouterList.push({
        key: componentConfig.key,
        title: componentConfig.title,
        path: componentConfig.path,
        // src: componentConfig.__file,
        fileName: fileName
    })
})
Storage.setLocalStorage(all_router_key, RouterList)
export default RouterList;
/**
 * 测试用例模块
 */
// let TestCase = []
// const TestComponent = require.context('../../test/', true, /\.vue$/)
// TestComponent.keys().forEach(filePath => {
//     const componentConfig = TestComponent(filePath).default
//     const fileName = filePath.match(/.\/(\S*).vue/)[1]
//     componentConfig.path && TestCase.push({
//         path: componentConfig.path,
//         fileName: fileName,
//     })
// })
// export const Testcase = TestCase
